<script>
	function login_process(){
		var l_username = $("#l_username").val();
		var l_password = $("#l_password").val();
		
		$.ajax({
			url :"<?php echo base_url('c_login/process')?>",
			type:"POST",
			dataType:"JSON",
			data:{
					l_username:l_username,
					l_password:l_password
				 },
			success:function(response){
				// console.log(response);
				if(response.message == "true"){
					window.location = "<?php echo base_url()?>"
				} else {
					alert("Maaf, username atau password anda Salah !");
				}
			}
		});
	}
	
$(document).ready(function(){
	$("#l_username").keypress(function(e){
		if(e.keyCode == 13){
			$("#l_password").focus();
		}
	});
	
	$("#l_password").keypress(function(e){
		if(e.keyCode == 13){
			login_process();
		}
	});
});	
</script>
<style>
#form{
	margin : 10px auto 10px auto;
	width : 400px;
	text-align : center;
}

</style>
 
<div class="bg-color-blue" id="form">
<h2 class="fg-color-white">Login</h2>
<div class="control-group">
	<label class="control-label" for="inputUsername">Username</label>
	<div class="controls">
		<input type="text" id="l_username" placeholder="Username"  class="input-control">
	</div>
</div>

<div class="control-group">
	<label class="control-label" for="inputPassword">Password</label>
	<div class="controls">
		<input type="password" id="l_password" placeholder="Password"  class="input-control">
	</div>
</div>

<div class="control-group">
	<div class="controls">
		<button type="submit" class="btn" onClick="login_process()">Sign in</button>
	</div>
</div>
</div>